home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amoszine 3
/
Amoszine 3.adf
/
MORE_SOURCE
/
intuition.amos.pp
/
intuition.amos
/
intuition.amosSourceCode
Wrap
AMOS Source Code
|
1992-02-26
|
8KB
|
501 lines
' ******************
' * AMOS Intuition *
' ******************
' *** Original Program Supplied With AMOS Professional,
' Requester Procedures & Close Gadget Written By John.A.Kinsella.
' *** Define WB Variable.
Dim WINCON(1)
' *** Switch To CLI.
Amos To Back
' *** Open Window.
_WINDOPEN[1,0,0,640,100,"<- Quits...",1]
' *** Set Character Codes.
M$=Chr$(10)
E$=Chr$($9B)+"3;31;42m"
B$=Chr$($9B)+"1;31;42m"
O$=Chr$($9B)+"0m"
' *** Print Text.
_WPRINT[1,Chr$(10)]
_WPRINT[1,E$+" AMOS Intuition Example... "+O$]
_WPRINT[1,Chr$(10)]
_WPRINT[1,Chr$(10)]
_WPRINT[1,B$+" Use BUTTON, REQUESTER or ENDCLI keywords..."+O$]
_WPRINT[1,Chr$(10)]
' *** MAIN LOOP.
Do
1
' *** Display prompt.
_WPRINT[1,M$+"AMOS> "]
' *** Read Input (160 Characters).
_WINPUT[1,160]
' *** Check For File-Requester.
If Upper$(CHAR$)="REQUESTER"
' *** Call file requester.
_WFILREQ["Ram Disk:"]
' *** Display Selected File.
If ERR=-1
_WPRINT[1,"File Selected = '"+FIL$+"'"]
Print F$
Goto 1
End If
End If
' *** Check For Button Requester.
If Upper$(CHAR$)="BUTTON"
' *** Call Button Requester.
_WBUTREQ["***Requester Choose_A_Button 1 2 3 4 5"]
' *** Display Number Of Button Selected (0 For Last Button Always).
If ERR=-1
_WPRINT[1,"Button Selected = '"+Str$(BUT)-" "+"'"]
Print F$
Goto 1
End If
End If
' *** Check For Close Gadget.
If CHAR$=Space$(CHARS)
Goto FIN
End If
' *** Check For EndCLI Command.
If Upper$(CHAR$)="ENDCLI"
Goto FIN
End If
' *** Execute Anything Else Entered.
If CHAR$<>""
Print CHAR$
_WINDEXECUTE[1,CHAR$]
End If
Loop
' *** Quit.
FIN:
' *** Close Window.
_WINDCLOSE[1]
' *** Get & Print Date.
_DATE
Print "DATE - ";Param$
' *** Get & Print Time.
_TIME
Print "TIME - ";Param$
' *** Bring Amos To Front & End.
Amos To Front
End
Procedure _WINDOPEN[N,X,Y,XX,YY,NAME$,CL]
' N - No of window.
' X - Xpos of window.
' Y - Ypos of window.
' XX - Width of window.
' YY - Height of window.
' NAME$ - Title of window.
' CL - Close gadget 0=Off 1=On (WB2 Only).
' ERR - Output error code.
' *** Give User Access To Error Code.
Shared ERR,WINCON()
' *** Turn The X,Y,XX,YY,NAME$,CL Data Into Format Usable By DOS.
X$=Str$(X)-" "
Y$=Str$(Y)-" "
XX$=Str$(XX)-" "
YY$=Str$(YY)-" "
CON$="CON:"+X$+"/"+Y$+"/"+XX$+"/"+YY$+"/"+NAME$
If CL=1
CON$=CON$+"/CLOSE"
End If
CON$=CON$+Chr$(0)
' *** Call DOS Open Function.
Dreg(1)=Varptr(CON$)
Dreg(2)=1005
WINCON(N)=Doscall(-30)
If WINCON(N)=0
ERR=Doscall(-132)
End If
End Proc
Procedure _WPRINT[N,M$]
' N - No of window.
' M$ - Text to be printed.
' ERR - Output error code.
' *** Give User Access To Error Code.
Shared ERR,WINCON()
If WINCON(N)=0
Goto ERR
End If
' *** Call The DOS Write Function.
Dreg(1)=WINCON(N)
Dreg(2)=Varptr(M$)
Dreg(3)=Len(M$)
X=Doscall(-48)
If X=0
Goto ERR
End If
Pop Proc
' *** In Case Of Error.
ERR:
ERR=Doscall(-132)
End Proc
Procedure _WINPUT[N,NUM]
' N - No of window.
' NUM - No of chars to read in.
' ERR - Output error code.
' CHAR$ - Output text read in.
' CHARS - Output length read in.
' *** Give User Access To Error Code And The String Entered.
Shared ERR,WINCON(),CHAR$
Global CHARS
CHARS=NUM
If WINCON(N)=0
Goto ERR
End If
' *** Initialise Return Variable.
CHAR$=Space$(NUM)
' *** Call DOS Read Function.
Dreg(1)=WINCON(N)
Dreg(2)=Varptr(CHAR$)
Dreg(3)=NUM
X=Doscall(-42)
If X=0
Goto ERR
End If
A=Instr(CHAR$,Chr$(10))
If A>0
CHAR$=Mid$(CHAR$,1,A-1)
End If
Pop Proc
' *** In Case Of Error.
ERR:
ERR=Doscall(-132)
End Proc
Procedure _WINDEXECUTE[N,COM$]
' N - No of window.
' COM$ - Command to execute.
' ERR - Output error.
' *** Give User Access To Error Code.
Shared ERR,WINCON()
If WINCON(N)=0
Goto ERR
End If
' *** Call The DOS Execute Function.
COM$=COM$+Chr$(0)
Dreg(1)=Varptr(COM$)
Dreg(2)=0
Dreg(3)=WINCON(N)
X=Doscall(-222)
If X=0
Goto ERR
End If
Pop Proc
' *** In Case Of Error.
ERR:
ERR=Doscall(-132)
End Proc
Procedure _WINDCLOSE[N]
' N - No of window.
' ERR - Output error.
' *** Give The User Access To Error Code.
Shared ERR,WINCON()
If WINCON(N)=0
Goto ERR
End If
' *** Call DOS Close Function.
Dreg(1)=WINCON(N)
X=Doscall(-36)
If X=0
Goto ERR
End If
Pop Proc
' *** In case of error.
ERR:
ERR=Doscall(-132)
End Proc
Procedure _WFILREQ[PTH$]
' PTH$ - Directory path.
' *** Give User Access To Error Code And The Filename.
' *** ERR = 0 : File-Requester Program Not Found.
' ERR = -1 : File-Requester Program Found.
Shared ERR,FIL$
' *** Check For Requester Program.
If Not Exist("C:RequestFile")
ERR=0
Pop Proc
End If
' *** Execute Requester Program.
_WINDEXECUTE[1,"C:RequestFile >Ram:AMOS-Temp.001 "+Chr$(34)+PTH$+Chr$(34)]
' *** Read In Selected File.
Open In 1,"Ram:AMOS-Temp.001"
F$=Input$(1,Lof(1))
Close 1
' *** Delete Temp File.
Kill "Ram:AMOS-Temp.001"
' *** Arrange Filename Into String.
I=Instr(F$,Chr$(34),2)
FIL$=Mid$(F$,2,I-2)
' *** Set Error Code.
ERR=-1
End Proc
Procedure _WBUTREQ[DEF$]
' DEF$ - Default requester line, this line sets up the message & buttons.
' *** Give User Access To Error Code And The Button No Selected.
' *** ERR = 0 : Button-Requester Program Not Found.
' ERR = -1 : Button-Requester Found.
Shared ERR,BUT
' *** Check For Requester Program.
If Not Exist("C:RequestChoice")
ERR=0
Pop Proc
End If
' *** Execute Button Program.
_WINDEXECUTE[1,"Sys:c/RequestChoice >Ram:AMOS-Temp.001 "+DEF$]
' *** Read In Selected Button.
Open In 1,"Ram:AMOS-Temp.001"
F$=Input$(1,Lof(1))
Close 1
' *** Delete Temp File.
Kill "Ram:AMOS-Temp.001"
' *** Arrange Button Selected Into A Variable.
For I=Len(F$)-1 To 1 Step -1
Exit If Mid$(F$,LOP,1)<>" "
Next I
BUT=Val(Left$(F$,I))
' *** Set Error Message.
ERR=-1
End Proc
Procedure _DATE
' Param$ - Output data string.
' *** Call DOS DateStamp Function.
T$=Space$(12)
Dreg(1)=Varptr(T$)
RIEN=Doscall(-192)
NJ=Leek(Varptr(T$))
' *** Find This Year's First Day.
A=1978
JOUR=7
Do
BIS=0
If(A and 3)=0
BIS=1
End If
Exit If NJ-365-BIS<0
Add JOUR,1+BIS
If JOUR>7
Add JOUR,-7
End If
Add NJ,-365-BIS
Inc A
Loop
' *** Find Month.
M=1
Do
Read N
Exit If NJ-N<0
Add NJ,-N
Inc M
Loop
Inc NJ
' *** Fabrique La Chaine.
J$=Mid$(Str$(NJ),2)
If Len(J$)<2
J$="0"+J$
End If
M$=Mid$(Str$(M),2)
If Len(M$)<2
M$="0"+M$
End If
A$=Mid$(Str$(A),2)
DATE$=J$+"-"+M$+"-"+A$
' *** Length Of Each Month.
Data 31,28+BIS,31,30,31,30,31,31,30,31,30,31
End Proc[DATE$]
Procedure _TIME
' Param$ - Output time string.
' *** Call DOS Function.
T$=Space$(12)
Dreg(1)=Varptr(T$)
RIEN=Doscall(-192)
MN=Leek(Varptr(T$)+4)
SEC=Leek(Varptr(T$)+8)
' *** Minutes calculation.
H=MN/60
H$=Mid$(Str$(H),2)
If Len(H$)<2
H$="0"+H$
End If
M=MN mod 60
M$=Mid$(Str$(M),2)
If Len(M$)<2
M$="0"+M$
End If
' *** Seconds calculation.
S=SEC/50
S$=Mid$(Str$(S),2)
If Len(S$)<2
S$="0"+S$
End If
' *** Final String.
TIME$=H$+":"+M$+":"+S$
End Proc[TIME$]